/**
 * 
 */
package org.swing.utility.common.imp;

/**
 * @author lqnhu
 *
 */
public interface SimpleMap<V> {
	/**
	 * Returns the value to which this map maps the specified key. Returns null
	 * if the map contains no mapping for this key. A return value of null does
	 * not necessarily indicate that the map contains no mapping for the key;
	 * it's also possible that the map explicitly maps the key to null. The
	 * containsKey operation may be used to distinguish these two cases. <br>
	 * More formally, if this map contains a mapping from a key k to a value v
	 * such that (key==null ? k==null : key.equals(k)), then this method returns
	 * v; otherwise it returns null. (There can be at most one such mapping.)
	 * 
	 * @param key
	 *            The key whose associated value is to be returned.
	 * @return The value to which this map maps the specified key, or null if
	 *         the map contains no mapping for this key.
	 * @throws IllegalArgumentException
	 *             Thrown if the key or value is not valid
	 */
	public V get(String key) throws IllegalArgumentException;

	/**
	 * Associates the specified value with the specified key in this map. If the
	 * map previously contained a mapping for this key, the old value is
	 * replaced by the specified value. (A map m is said to contain a mapping
	 * for a key k if and only if m.containsKey(k) would return true.)
	 * 
	 * @param key
	 *            The key with which the specified value is to be associated.
	 * @param value
	 *            The value to be associated with the specified key.
	 * @return The previous value associated with specified key, or null if
	 *         there was no mapping for key. A null return can also indicate
	 *         that the map previously associated null with the specified key,
	 *         if the implementation supports null values.
	 * @throws IllegalArgumentException
	 *             Thrown if the key or value is not valid
	 */
	public V put(String key, V value) throws IllegalArgumentException;

	/**
	 * Returns the number of key-value mappings in this map.
	 * 
	 * @return The number of key-value mappings in this map.
	 */
	int size();
}
